home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
net
/
k20menus.lzh
/
k20pop.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-10
|
3KB
|
171 lines
/* Copyright 1992 H.Ogasawara (COR.) */
#include <corlib.h>
#include "k20menu.h"
extern int font;
extern int autoexit,
ncflag;
extern short dspmode;
extern WindowID Awp, Bwp;
extern unsigned char **lp;
extern NET_MENU *top;
static char *menu[]= {
"最終LOG表示",
"最終LOG新規",
"表示:月集計",
"表示:最終値",
"表示:電 話",
"表示:RS/LOG",
"表示:モデム",
"表示:手 順",
"NET設定修正",
}/*, *menu2[]= {
"表示:月集計",
"表示:最終値",
"表示:電 話",
"表示:RS/LOG",
"表示:モデム",
"表示:手 順",
"NET設定追加",
}*/;
#define menus (sizeof(menu)/sizeof(char*))
#define menus2 (sizeof(menu2)/sizeof(char*))
static char View[]= "view.win";
getdate( buf )
char *buf;
{
DATEASC( (DATEBIN(BINDATEGET())&0x0fffffff)+0x30000000, buf );
}
getlog( buf2, n )
unsigned char *buf2;
{
NET_MENU *net= (NET_MENU*)net_count( n );
if( net && *net->lastlogin ){
unsigned char buf[256];
unsigned char buf1[20];
unsigned char *ptr, *str;
ngetword( buf, net->line, 5 );
for( str= buf2, ptr= buf ; *ptr ; ptr++ ){
switch( *ptr ){
case '*':
/*getdate( buf1 );*/
*str++= net->lastlogin[0];
*str++= net->lastlogin[1];
*str++= net->lastlogin[3];
*str++= net->lastlogin[4];
*str++= net->lastlogin[6];
*str++= net->lastlogin[7];
break;
case '@':
/*getdate( buf1 );*/
*str++= net->lastlogin[3];
*str++= net->lastlogin[4];
*str++= net->lastlogin[6];
*str++= net->lastlogin[7];
break;
case '\\':
if( *++ptr == '$' && *++ptr == '(' ){
unsigned char *r= buf1,
ebuf[256];
for(;*ptr && *ptr!=')'; *r++=*ptr++ );
*r= '\0';
if( GETENV( buf1, NULL, ebuf )>=0 ){
str= (void*)astrcpy( str, ebuf );
}
}else
*str++= *ptr;
break;
default:
*str++= *ptr;
}
}
*str= '\0';
return TRUE;
}
return FALSE;
}
log_view( n, flag )
{
int i;
EventInfo info;
unsigned char log[256];
if( !getlog( log, n ) )
return;
if( flag && (i= PidSearch( View, 1 )) ){
static unsigned char *vbuf[2]= { NULL, NULL };
vbuf[0]= log;
info.option= EventUser;
info.ComData= UserStrings;
info.ComBuffer= vbuf;
WindowSendEventAll( i, &info );
return;
}
WindowLoadExec( View, log, NULL, NULL );
}
log_edit( n )
{
int i;
EventInfo info;
unsigned char log[256],
Edit[256];
if( !getlog( log, n ) )
return;
if( GETENV( "KOEDITOR", Edit, 0 ) < 0 )
strcpy( Edit, "ke.win" );
WindowLoadExec( Edit, log, NULL, NULL );
}
p_menu( n )
{
int i, x, y;
EventInfo info;
WindowGetEventInfo( &info );
if( n < 256 )
i= PopUpMenu( info.x-2, info.y+1, menu, menus, 12 );
#if 0
else{
i= PopUpMenu( info.x-2, info.y+1, menu2, menus2, 12 );
/* if( i == 6 )
i= 10;
else */if( i >= 0 && i <= 6 )
i+= 2;
}
#endif
switch( i ){
case 0:
log_view( n, TRUE );
break;
case 1:
log_view( n, FALSE );
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
dspmode= i-2;
make_line( top, lp );
WindowRedraw( Awp );
break;
case 8:
case 9:
case 10:
if( n < 256 ){
NET_MENU *net= (NET_MENU*)net_count( n );
if( net )
OpenDiag( info.x-2, info.y+1, net->line );
}else
OpenDiag( info.x-2, info.y+1, "" );
break;
}
}